from tinyshop_ui.data.findmethod import findmethod
from tinyshop_ui.data.findparm import findparm
<<<<<<< HEAD
from tinyshop_ui.data.readexcel import readexcel
def rundemo(path):
    readls = readexcel().read(path)
    txt = open(r'C:\Users\Administrator\Desktop\log.txt','w+')
=======
from tinyshop_ui.module.systemsettingsmodule import handmodule
def rundemo(path):
    readls = readexcel().read(path)
    txt = open(r'C:\Users\Administrator\Desktop\log.txt','w+')
>>>>>>> af1d2db8671062e46eb0dfd4ddd154afd93f2fa8
    for i in range(1,len(readls)):
        param1 = readls[i][0]
        param2 = readls[i][1]
        parm = findparm().data(readls[i][2])
        expect = findparm().data(readls[i][3])
        pathparm = readls[i][4]
        num = readls[i][5]
        if param1 == '商品中心':
            func = findmethod().method(pathparm)
            exp = func(param1,param2,parm,expect)
            if exp == True:
<<<<<<< HEAD
                ls = ['%s,pass\n'%num]
                txt.writelines(ls)
            else:
                ls = ['%s,fail\n'%num]
                txt.writelines(ls)
        elif param1 == '订单中心':
            func = findmethod().method(pathparm)
            exp = func(param1,param2,parm,expect)
            if exp == True:
                ls = ['%s,pass\n'%num]
                txt.writelines(ls)
            else:
                ls = ['%s,fail\n'%num]
                txt.writelines(ls)
        elif param1 == '客户中心':
            func = findmethod().method(pathparm)
            exp = func(param1,param2,parm,expect)
            if exp == True:
                ls = ['%s,pass\n'%num]
                txt.writelines(ls)
            else:
                ls = ['%s,fail\n'%num]
                txt.writelines(ls)
        elif param1 == '营销推广':
            func = findmethod().method(pathparm)
            exp = func(param1,param2,parm,expect)
            if exp == True:
                ls = ['%s,pass\n'%num]
                txt.writelines(ls)
            else:
                ls = ['%s,fail\n'%num]
                txt.writelines(ls)
        elif param1 == '内容管理':
            func = findmethod().method(pathparm)
            exp = func(param1,param2,parm,expect)
            if exp == True:
                ls = ['%s,pass\n'%num]
                txt.writelines(ls)
            else:
                ls = ['%s,fail\n'%num]
                txt.writelines(ls)
        elif param1 == '系统设置':
            func = findmethod().method(pathparm)
            exp = func(param1,param2,parm,expect)
            if exp == True:
                ls = ['%s,pass\n'%num]
                txt.writelines(ls)
            else:
                ls = ['%s,fail\n'%num]
                txt.writelines(ls)
        else:
            pass
    txt.close()
=======
                ls = ['%spass\n'%num]
                txt.writelines(ls)
                txt.seek(0)
                # print(num,'pass')
            else:
                ls = ['%sfail\n'%num]
                txt.writelines(ls)
                txt.seek(0)
        # elif param1 == '订单中心':
        #     func = findmethod().method(pathparm)
        #     exp = func(param1,param2,parm,expect)
        #     if exp == True:
        #         print(num,'pass')
        #     else:
        #         print(num,'fail')
        # elif param1 == '客户中心':
        #     func = findmethod().method(pathparm)
        #     exp = func(param1,param2,parm,expect)
        #     if exp == True:
        #         print(num,'pass')
        #     else:
        #         print(num,'fail')
        # elif param1 == '营销推广':
        #     func = findmethod().method(pathparm)
        #     exp = func(param1,param2,parm,expect)
        #     if exp == True:
        #         print(num,'pass')
        #     else:
        #         print(num,'fail')
        # elif param1 == '内容管理':
        #     func = findmethod().method(pathparm)
        #     exp = func(param1,param2,parm,expect)
        #     if exp == True:
        #         print(num,'pass')
        #     else:
        #         print(num,'fail')
        # elif param1 == '系统设置':
        #     func = findmethod().method(pathparm)
        #     exp = func(param1,param2,parm,expect)
        #     if exp == True:
        #         print(num,'pass')
        #     else:
        #         print(num,'fail')
    txt.close()
# handmodule().pingpaiguanli()
# handmodule().zhifufangshi()
# handmodule().guanlishouye()
# handmodule().xinximoban()
# handmodule().tixingguanli()
# handmodule().kaifangdenglv()
# handmodule().zhifufangshi()
# handmodule().quyuhuafen()
# handmodule().kuaidigongsi()
# handmodule().yunfeimoban()
# handmodule().guanliyuan()
>>>>>>> af1d2db8671062e46eb0dfd4ddd154afd93f2fa8
if __name__ == '__main__':
    path = r'C:\Users\Administrator\Desktop\auto_script.xlsx'
    rundemo(path)